/*
 * Copyright 2021 ThoughtWorks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import "../pipelines/vals";
@import "../../components/buttons/index";
@import "~prismjs/themes/prism"; // don't add the `.css` extension!! See https://github.com/sass/node-sass/issues/2362#issuecomment-388634848

$syntax-bg: #282923;
$error-container-width: 450px;
$initial-message-bg: rgba(255, 255, 255, 0.5);
$initial-message-z: 4; // just underneath the global page header z-index

$shell-sample-bg: $task-editor-bg;
$shell-sample-prompt: $white;
$shell-sample-cmd: $task-cmd-color;

.plugin-selector {
  align-items: center;

  .intro {
    font-size: 16px;
    margin: 0;
    padding: 0;
  }

  .single-form-el {
    margin-bottom: 0;
  }

  .choices {
    width: auto;
    min-width: 140px;
  }
}

.builder-form, .preview-pane {
  max-width: calc(50% - #{$fillable-section-margin});
  flex-basis: 50%;
  flex-shrink: 0;
  flex-grow: 0;
}

.preview-pane[class*="language-"] { // scss-lint:disable-line
  position: relative;
  margin: 0;

  code {
    white-space: pre;
    overflow-y: auto;
    display: block;
  }

  .initial-message {
    position: absolute;
    top: 250px;
    left: 50%;
    transform: translateX(-50%);
    padding: 30px;
    border-radius: 5px;
    background: $initial-message-bg;
    z-index: $initial-message-z;

    .comment {
      display: block;
      margin: 0;
      line-height: 0;
    }
  }
}

.logical-section {
  margin-bottom: 2em;

  &:last-of-type {
    margin-bottom: 0;
  }
}

.builder-section-heading {
  font-size: 18px;
  font-weight: 600;

  margin: 0 0 10px;
  padding: 0;
}

.subheading {
  width: 100%;

  h3 {
    font-size: 24px;
    font-weight: 600;

    margin: 0 0 10px;
    padding: 0;
  }

  .section-note {
    display: inline-block;
    font-size: 12px;
    margin: 0 0 20px;

    .attention {
      color: $go-danger;
    }
  }

  p {
    font-size: 16px;
  }
}

.minor-heading {
  font-size: 18px;
}

.download-instructions {
  flex-basis: 65%;
  flex-grow: 0;
  flex-shrink: 0;

  p {
    margin: 0;
    margin-bottom: 1em;
  }

  ol {
    margin: 0;
    padding: 0;

    li {
      list-style-position: inside;
      margin: 0;
      margin-left: 1em;
      padding: 0;
    }
  }
}

.download-action {
  flex-basis: 35%;
  flex-grow: 0;
  flex-shrink: 0;
  text-align: right;

  .error-response {
    float: left;
    text-align: left;
    max-width: 60%;
    color: $go-danger;
    word-break: break-all;
    hyphens: auto;
  }
}

.add-to-repo-example {
  pre {
    border-radius: 5px;
    padding: 15px;
    background-color: $shell-sample-bg;
    color: $shell-sample-cmd;
    font-family: Hack, monospace;
    font-size: 14px;
  }

  code {
    font-family: inherit;

    .line {
      line-height: 175%;

      &:before {
        display: inline-block;
        content: "$";
        margin-right: 1ex;
        color: $shell-sample-prompt;
      }
    }
  }
}

.actions {
  width: 100%;

  .btn-cancel {
    border: 1px solid $btn-reset;
    &:hover {
      background-color: $btn-reset;
      color: $white;
    }
  }

  .finish-btn-wrapper {
    float: right;

    .error-response {
      margin-right: 2ex;
      margin-top: 7px;
      color: $go-danger;
      display: inline-block;
      max-width: $error-container-width;
      white-space: normal;
      float: left;

      &:empty {
        margin-right: 0;
      }
    }
  }
}
